package tx.bj12320.model;

import javax.persistence.*;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bj12320.model.*;
import tx.bj12320.dao.*;
import tx.bj12320.service.*;
import tx.bj12320.vo.query.*;


@Entity
@Table(name = "BJ12320_DATA_DICT")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class DataDict extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "DataDict";
	public static final String ALIAS_DD_ID = "ddId";
	public static final String ALIAS_DD_NAME = "ddName";
	public static final String ALIAS_DD_CODE = "ddCode";
	public static final String ALIAS_DD_VALUE = "ddValue";
	public static final String ALIAS_DD_TYPE = "ddType";
	public static final String ALIAS_DD_LEVEL = "ddLevel";
	public static final String ALIAS_DD_PARENT_ID = "ddParentId";
	public static final String ALIAS_DD_PARENT_CODE = "ddParentCode";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * ddId       db_column: DD_ID
     */

	private Long ddId;
    /**
     * ddName       db_column: DD_NAME
     */
	@Length(max=500)
	private java.lang.String ddName;
    /**
     * ddCode       db_column: DD_CODE
     */
	@Length(max=500)
	private java.lang.String ddCode;
    /**
     * ddValue       db_column: DD_VALUE
     */
	@Length(max=2000)
	private java.lang.String ddValue;
    /**
     * ddType       db_column: DD_TYPE
     */
	@Length(max=500)
	private java.lang.String ddType;
    /**
     * ddLevel       db_column: DD_LEVEL
     */

	private Long ddLevel;
    /**
     * ddParentId       db_column: DD_PARENT_ID
     */

	private Long ddParentId;
    /**
     * ddParentCode       db_column: DD_PARENT_CODE
     */
	@Length(max=500)
	private java.lang.String ddParentCode;
	//columns END


	public DataDict(){
	}

	public DataDict(
		Long ddId
	){
		this.ddId = ddId;
	}



	public void setDdId(Long value) {
		this.ddId = value;
	}

	@Id	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="BJ12320_DATA_DICT_SEQU")
    @SequenceGenerator(name="BJ12320_DATA_DICT_SEQU",allocationSize=1,initialValue=1, sequenceName="BJ12320_DATA_DICT_SEQU")
	@Column(name = "DD_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 22)
	public Long getDdId() {
		return this.ddId;
	}

	@Column(name = "DD_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDdName() {
		return this.ddName;
	}

	public void setDdName(java.lang.String value) {
		this.ddName = value;
	}

	@Column(name = "DD_CODE", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDdCode() {
		return this.ddCode;
	}

	public void setDdCode(java.lang.String value) {
		this.ddCode = value;
	}

	@Column(name = "DD_VALUE", unique = false, nullable = true, insertable = true, updatable = true, length = 2000)
	public java.lang.String getDdValue() {
		return this.ddValue;
	}

	public void setDdValue(java.lang.String value) {
		this.ddValue = value;
	}

	@Column(name = "DD_TYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDdType() {
		return this.ddType;
	}

	public void setDdType(java.lang.String value) {
		this.ddType = value;
	}

	@Column(name = "DD_LEVEL", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getDdLevel() {
		return this.ddLevel;
	}

	public void setDdLevel(Long value) {
		this.ddLevel = value;
	}

	@Column(name = "DD_PARENT_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getDdParentId() {
		return this.ddParentId;
	}

	public void setDdParentId(Long value) {
		this.ddParentId = value;
	}

	@Column(name = "DD_PARENT_CODE", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDdParentCode() {
		return this.ddParentCode;
	}

	public void setDdParentCode(java.lang.String value) {
		this.ddParentCode = value;
	}


	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("DdId",getDdId())
			.append("DdName",getDdName())
			.append("DdCode",getDdCode())
			.append("DdValue",getDdValue())
			.append("DdType",getDdType())
			.append("DdLevel",getDdLevel())
			.append("DdParentId",getDdParentId())
			.append("DdParentCode",getDdParentCode())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getDdId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof DataDict == false) return false;
		if(this == obj) return true;
		DataDict other = (DataDict)obj;
		return new EqualsBuilder()
			.append(getDdId(),other.getDdId())
			.isEquals();
	}

	private List<DataDict> children;

	@Transient
	public List<DataDict> getChildren() {
		return children;
	}

	public void setChildren(List<DataDict> children) {
		this.children = children;
	}
}

